import 'package:sqflite/sqflite.dart'; //导入sqflite包
import 'package:path/path.dart'; //join方法

class SqfliteHelper{
  static String _dbName='tongxin.db';
  static Database _db;

  static Future<Database> getInstance()async {
    if (_db == null) {
      _db = await _init();
    }
    return _db;
  }

 static Future<Database>  _init() async{
    var db = await openDatabase(join(await getDatabasesPath(),_dbName),
    onCreate:(db,version) {
    return db.execute(
      "CREATE TABLE music_list_table(musicName TEXT PRIMARY KEY, singer TEXT, musicTotalTime INTEGER, describe TEXT, nameExtension TEXT)",
    );
  },
  version: 1);
  return db;
  }
}